<!-- BEGIN PAGE HEADER-->
<?php $this->load->view('partials/breadcrumb.tpl') ?>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<script type="text/javascript">
    function defConfirm(url) {
        if (!confirm("确定要删除吗？")) {
            return false;
        }
        window.location.href = url;
        return true;
    }

    $(document).ready(function () {
        $("#reset").click(function () {
            $("select").val('');
            $("input[type='text']").val('');
        });
    });
</script>
<div class="row">
    <div class="col-xs-12">
        <!-- Begin: life time stats -->
        <div class="portlet">
            <?= form_open('', Array('class' => 'form-inline', 'role' => 'form')) ?>
            <?= search_form_input('name', filterValue('name'), '账户名称', 'class="form-control input-medium"'); ?>
            <?php if($this->_user->role_id == 1):?>
                <?=search_form_dropdown('group_id', array(''=>'所属管理组')+$groups, filterValue('group_id'), '所属管理组' ,'class="form-control input-small"'); ?>
            <?php else:?>
            <?=search_form_dropdown('group_id', array(''=>'所属管理组')+$groups, filterValue('group_id'), '所属管理组' ,'class="form-control input-small" disabled = "disabled"'); ?>
            <?php endif; ?>
            <?= search_form_dropdown('country', array('' => '选择国家...') + IOSS_StaticConfig::getCountryInfo(), filterValue('country'), '国家', 'class="form-control input-xs"'); ?>
            <?= search_form_dropdown('status', array('' => '选择状态...') + MShop::getState(), filterValue('status'), '状态', 'class="form-control input-medium"'); ?>
            <?= search_form_input('shop_number_perpage', filterValue('shop_number_perpage'), '每页显示条数', 'class="form-control input-xs"'); ?>
            <label style="float: right;margin-right: 20px" class="label label-danger">总计<?=$total_number ?>条</label>
            <button type="button" class="btn default" id="reset">重置条件</button>
            <button type="submit" class="btn green about_search">搜索 <i class="fa fa-search"></i></button>
            <?= form_close() ?>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="table-scrollable">
                            <table class="table table-hover table-bordered table-striped">
                                <thead>
                                <tr>

                                    <th>ID</th>
                                    <th>站点名称</th>
                                    <th>所有者</th>
                                    <th>所属管理组</th>
                                    <th>国家</th>
                                    <th>状态</th>
                                    <th>创建时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($list as $v) { ?>
                                    <tr>

                                        <td><?= $v->id ?></td>
                                        <td>
                                            <?php if ($p->edit) { ?>
                                                <a href="<?= site_url($thisModule . $thisController . '/edit/' . $v->id) ?>"><?= htmlspecialchars($v->name) ?></a>
                                            <?php } else { ?>
                                                <?= htmlspecialchars($v->name) ?>
                                            <?php } ?>
                                        </td>
                                        <td><?= $allShopAdmins[$v->owner_id]; ?></td>
                                        <td><?= MAdminGroup::getAllGroupsByType(1)[$v->group_id]; ?></td>
                                        <td><label class="label label-warning"><?= IOSS_StaticConfig::getCountryInfo($v->country) ?></label></td>
                                        <td><label class="label label-primary"><?= MShop::getState($v->status); ?></label></td>
                                        <td><?= date('Y-m-d H:i:s', $v->create_time) ?></td>
                                        <td>
                                            <div class="btn-group btn-group-solid">
                                                <a href="<?= site_url($thisModule . $thisController . '/edit/' . $v->id) ?>"
                                                   class="btn btn-sm purple <?= $p->edit ? '' : 'disabled' ?>"><i
                                                            class="fa fa-edit"></i> 编辑</a>
                                                <?php if ($p->delete) { ?>
                                                    <a class="btn btn-sm red hide"
                                                       href="javascript:void(defConfirm('<?= site_url($thisModule . $thisController . '/delete/' . $v->id . '/' . $v->update_time) ?>'));"><i
                                                                class="fa fa-trash-o"></i> <?= l('delete') ?></a>
                                                <?php } ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 text-right">
                        <?= $pagination ?>
                    </div>
                </div>
            </div>
        </div>
        <!-- End: life time stats -->
    </div>
</div>
<!-- END PAGE CONTENT-->
